package controller.admin;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import pojo.Sanpham;
import pojo.Taikhoan;
import dao.TaikhoanDAO;

/**
 * Servlet implementation class Header
 */
@WebServlet("/Pages/AdminHome.do")
public class AdminHome extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public AdminHome() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		processRequest(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		processRequest(request, response);
	}

	protected void processRequest(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html;charset=UTF-8");

		HttpSession session = request.getSession();

		String action = request.getParameter("action");
		String url = "";
		
		if (action.equals("VaoTrangAdmin")) {

			request.setAttribute("page", "AdminPage");
			url = "../index.jsp";
		}
		
		if (action.equals("TrangQuanLyDonDatHang")) {

			request.setAttribute("page", "TrangQuanLyDonDatHang");
			url = "../index.jsp";
		}
		
		RequestDispatcher rd = request.getRequestDispatcher(url);
		rd.forward(request, response);
	}
}
